﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Validate.Net
{
    /// <summary>
    /// 数字格式字符串校验
    /// </summary>
    public class ValidateNumberAttribute : ValidateRegularAttribute
    {
        private static string numberRegular = @"^[0-9]*$";

        public ValidateNumberAttribute() : base(numberRegular)
        { }

        public override bool Validate(object value, out string msg)
        {
            if (base.Validate(value, out msg))
                return true;
            else
            {
                msg = "数字格式字符串校验失败。";
                return false;
            }
        }
    }
}
